<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/11/29 0029
  Time: 11:39
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<script src = "jquery/jquery-3.0.0.min.js"></script>
<script>
    $(function () {
        $(":button").click(function () {
            $.ajax({
                type:"get",
                url:"${pageContext.request.contextPath}/lservlet",
                data:$("form").serialize(),
                success:function (msg) {
                    if(msg==="ok"){
                        alert("ok");
                        $("form").submit();
                    }else{
                        $("sapn").text(msg);
                    }
                    }
            })
        })
    })
</script>
<body>
<form action="city.jsp">
    用户名<input type="text" name="u_name" > <br>
    密码<input type="text" name="u_pwd"> <br>
    <input type="button" value="测试" > <span></span><br>
    <input type="submit">
</form>

</body>
</html>
